#!/usr/bin/perl
use warnings;
use strict;

my ($v) = @ARGV;

if (not defined $v) {
	die "value is required\n";
}

my @X = (1..999);
my @Y = (1..999);
my ($y, $r, $d, $m, $vx, $vy);

$m = 99999;

for $y (@Y) {
	foreach(@X) {
		$r = $y/$_;
		$d = abs($v - $r);
		if ($d < $m) {
			$vx = $_;
			$vy = $y;
			$m = $d;
		}
	}
}

printf "%d %d (%.35f)\n", $vy, $vx, (($vy/$vx) - $v);
